<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  function getMaxValue(arr) {
    if(arr&&arr.length>0){
      let max = arr[0];
      for(let i=0;i<arr.length;i++ ){
        arr[i]>max && (max=arr[i]);
      }
      return max;
    }else {
      return;
    }
  }
  let arr = [1,8,56,22,77,22244,100000];
  console.log(getMaxValue(arr))
</script>
</body>
</html>